package com.javalong.affairs.module.renwujinzhang.activity;

import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.javalong.affairs.R;
import com.javalong.affairs.base.common.UIStatus;
import com.javalong.affairs.base.common.ViewHolder;
import com.javalong.affairs.base.constant.BundleKey;
import com.javalong.affairs.base.constant.RequestCode;
import com.javalong.affairs.base.model.User;
import com.javalong.affairs.module.renwujinzhang.ui.SelectTimeView;
import com.javalong.affairs.module.renwujinzhang.ui.SelectUserView;

import java.util.List;

/**
 * 审核任务
 */
public class SuperviseActivity extends RecycleListActivity {


    public static void toThisActivity(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, SuperviseActivity.class);
        context.startActivity(intent);
    }

    @Override
    public void afterInit() {
        getSupportActionBar().setTitle("任务详情");
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        switch (viewType) {
            case TIME:
                return new ViewHolder(new SelectTimeView(this));
            case MULTI_USER:
                return new ViewHolder(new SelectUserView(this));
            case EDIT:
                return new ViewHolder(mInflater.inflate(R.layout.item_imageedit, parent, false));
            case BUTTON:
                return new ViewHolder(mInflater.inflate(R.layout.item_button, parent, false));
            case TEXT:
                return new ViewHolder(mInflater.inflate(R.layout.item_text, parent, false));
        }
        return new ViewHolder(mInflater.inflate(R.layout.item_imageedit, parent, false));
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        switch (position) {
            case 0: {
                EditText editText = holder.getView(R.id.et_right);
                editText.setEnabled(false);
                editText.setHint("打扫卫生");
            }
            break;
            case 1: {
                EditText editText = holder.getView(R.id.et_right);
                editText.setEnabled(false);
                editText.setHint("打扫卫生打扫卫生打扫卫生 ");
            }
            break;
            case 2: {
                holder.itemView.setEnabled(false);
                ((SelectTimeView) holder.itemView).setHintText("2011年05月25 11:11");
                ((SelectTimeView) holder.itemView).setStatus(UIStatus.WATCH);
            }
            break;
            case 3: {
                holder.itemView.setEnabled(false);
                ((SelectTimeView) holder.itemView).setHintText("2011年05月25 11:11");
                ((SelectTimeView) holder.itemView).setStatus(UIStatus.WATCH);
            }
            break;
            case 4: {
                holder.itemView.setEnabled(false);
                ((SelectUserView) holder.itemView).setHintText("杨观回");
                ((SelectUserView) holder.itemView).setStatus(UIStatus.WATCH);
            }
            break;
            case 5: {
                Button button = holder.getView(R.id.bt_item);
                button.setText("点赞");
            }
            break;
            case 6: {
                Button button = holder.getView(R.id.bt_item);
                button.setText("查看B的任务");
            }
            break;
            case 7: {
                Button button = holder.getView(R.id.bt_item);
                button.setText("查看A的任务");
            }
            break;
            case 8: {
                Button button = holder.getView(R.id.bt_item);
                button.setText("评论");
            }
            break;
            case 9: {
                TextView textview = holder.getView(R.id.tv_item);
                textview.setText("评论：");
            }
            break;
        }
    }

    @Override
    public int getItemViewType(int position) {
        switch (position) {
            case 0:
                return EDIT;
            case 1:
                return EDIT;
            case 2:
                return TIME;
            case 3:
                return TIME;
            case 4:
                return MULTI_USER;
            case 5:
                return BUTTON;
            case 6:
                return BUTTON;
            case 7:
                return BUTTON;
            case 8:
                return BUTTON;
            case 9:
                return TEXT;
        }
        return 0;
    }

    @Override
    public int getItemCount() {
        return 10;
    }

}
